<template>
  <div>
    <f-form ref='form' :action='api.paymentDetails' :form-key='this.formItem.paymentDetailsId'  :file-ids='fileIds'>
      <div>
        <f-form-item label='结算金额' :required='true' data-type='number' disabled name='settleAmount' :value.sync='formItem.settleAmount' />
        <f-form-item label='收款人' name='payeeName' disabled :required='true' :value='formItem.payeeName' />
        <f-form-item label='支付日期' type='date' name='settleDate' :required='true' :value='formItem.settleDate' />
        <f-form-item label='附件' type='upload' name='paymentImage' :file-group='2' :value='formItem.paymentImage' :file-max='3' :busId='this.formItem.paymentDetailsId' busType='BusPaymentDetails' :realRemove='false' @uploadSuccess='uploadSuccess' />
      </div>
    </f-form>

  </div>
</template>
<script>

import api from "../../../../js/api"


export default {
  name: "SalemanPay",
  components: {},
  data() {
    let me = this
    return {
      api: Object.assign(api, this.api),
      //列表初始化查询参数
      queryParam: {},
      loaded: false,
      paymentId: "",
      fileIds: null,
      formItem: this.getFormItem()
    }
  },
  created() {
  },
  computed: {},
  methods: {
    getFormItem() {
      return {
        paymentDetailsId: "",
        remark: ""
      }
    },
    setData(data) {
      if (data.paymentDetailsId) {
        this.$refs.form.resetFields()
        this.paymentDetailsId = data.paymentDetailsId
        this.getSettlePayInfo()
      }
    },
    /**
     * 获取支付信息
     */
    getSettlePayInfo() {
      this.http.get(this, {
        url: this.api.paymentDetails.get,
        params: {
          paymentDetailsId: this.paymentDetailsId
        },
        success: (me, data) => {
          this.$nextTick(() => {
            this.formItem = data
            this.$forceUpdate()
          })
        }
      })
    },
    /**
     * 文件上传回调
     */
    uploadSuccess(fileUrl, files, fileIds, removeIds) {
      this.fileIds = fileIds
      this.removeIds.push(...removeIds)
    },

    handleSubmit() {
      this.$refs["form"].submit({}, this.handleSuccess)
    },
    handleSuccess() {
      this.$emit("closeDrawer", false)
    }
  }
}
</script>
